#ifndef MEDIAPLAYER_H
#define MEDIAPLAYER_H

#include "gui.h"

#include <QWidget>
#include <QtGui/QWidget>
#include <QtGui/QApplication>
#include <QtCore/QTimerEvent>
#include <QtGui/QShowEvent>
#include <QtGui/QIcon>
#include <QtCore/QBasicTimer>
#include <QtGui/QAction>

#include <phonon/audiooutput.h>
#include <phonon/effect.h>
#include <phonon/effectwidget.h>
#include <phonon/mediaobject.h>
#include <phonon/videowidget.h>
#include <QMessageBox>

#include "ktv/ktv.h"

class MyItem;

class MediaPlayer : public QWidget
{
     Q_OBJECT
public:
    MediaPlayer(KTV *k, int w, int h);
    ~MediaPlayer();
    void setFullScreen(bool fullScreen);
    void nextFile();
    void openFile(QString file);
    void playList();
    void pause();
    void continuePlaying();
    void turnUp();
    void turnDown();
    void appendSong(MyItem *song);
    // GUI
    void exchange() { ktv->exchange(); }
protected:
    void changeEvent(QEvent *e);
    void keyPressEvent(QKeyEvent *event);

public slots:
    void deleteFirst();
private:
    KTV *ktv;
    int width;
    int height;

    bool isExist(QString location);
    Phonon::MediaObject m_MediaObject;
    Phonon::AudioOutput m_AudioOutput;
    Phonon::VideoWidget *m_videoWidget;
    QList<Phonon::MediaSource> * sourceList;
};

#endif // MEDIAPLAYER_H
